package com.iring.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

import com.google.gson.Gson;
import com.iring.exception.config.ERRVO;
import com.iring.exception.config.ErrorEnum;

/**
 * 403
 * 不具有权限异常
 *
 * @author wanggan
 */
@ResponseStatus(HttpStatus.FORBIDDEN)
public class AuthenticationException extends RuntimeException {

    private static final long serialVersionUID = -6475148028662664405L;
    
    private static Gson gson = new Gson();
    

    public AuthenticationException() {
        super("NOT AuthenticationException");
    }

    public AuthenticationException(String msg) {
        super(msg);
    }

    public AuthenticationException(String code, String msg) {
        super(gson.toJson(new ERRVO(code, msg)));
    }

    public AuthenticationException(ErrorEnum errorEnum) {
        super(gson.toJson(new ERRVO(errorEnum.getCode(), errorEnum.getMsg())));
    }
}
